/**
 2.用了模板字面量类型，同事直呼太强了！


 笔记：
   
 */

type Direction = "left" | "right" | "top" | "bottom";

// type CssPadding = "padding-left" | "padding-right" | "padding-top" | "padding-bottom"
type CssPadding = `padding-${Direction}`;

type EventName<T extends string> = `${T}Changed`;

type Concat<S1 extends string, S2 extends string> = `${Uppercase<S1>}-${S2}`;

// type T3 = "fooChanged" | "barChanged" | "bazChanged"
type T3 = EventName<"foo" | "bar" | "baz">;

// type T4 = "top-left" | "top-right" | "bottom-left" | "bottom-right"
type T4 = Concat<"top" | "bottom", "left" | "right">;

type InferRoot<T> = T extends `${infer R}${Capitalize<Direction>}` ? R : T;

type T7 = InferRoot<"marginRight">; //type T7 = "margin"
